<template>
	<view>
		<view style="padding-bottom: 100rpx;">
			<view style="padding: 20rpx 30rpx;">
				<text>申请详情</text>
			</view>
			<u-cell-group v-if="data">
				<u-cell-item   :arrow="false">
					<view slot="title">
						<text style="font-weight: bold;color: #000;" >开票金额</text>
					</view>
					<view slot="right-icon">
						<text style="font-weight: bold;color: #000;" class="currency">{{data.je}}</text>
					</view>
				</u-cell-item>
				<u-cell-item title="订单号"  :arrow="false">
					<view slot="right-icon">
						<text v-if="data.orders.length>0" >{{data.orders[0].orders_num}}</text>
						<text v-else>未关联</text>
					</view>
				</u-cell-item>
				<u-cell-item title="申请时间" :value="myTimeFormat(data.tjsj)" :arrow="false"></u-cell-item>
				<u-cell-item title="客户姓名" :value="data.khxm" :arrow="false"></u-cell-item>
				<u-cell-item title="手机号" :value="data.sjh" :arrow="false"></u-cell-item>
				<u-cell-item title="邮箱" :value="data.yx?data.yx:''" :arrow="false"></u-cell-item>
			</u-cell-group>
			<view style="padding: 20rpx 30rpx;">
				<text>发票信息</text>
			</view>
			<u-cell-group v-if="data">
				<u-cell-item title="发票类型"  :arrow="false">
					<view slot="right-icon">
						<text v-if="data.fplx==1">数电普通发票</text>
						<text v-if="data.fplx==2">数电专用发票</text>
					</view>
				</u-cell-item>
				<u-cell-item title="名称" :value="data.mc" :arrow="false"></u-cell-item>
				<u-cell-item title="税号" :value="data.sh" :arrow="false"></u-cell-item>
				<u-cell-item title="地址" :value="data.dz" :arrow="false"></u-cell-item>
				<u-cell-item title="电话" :value="data.dh" :arrow="false"></u-cell-item>
				<u-cell-item title="开户银行" :value="data.khyh" :arrow="false"></u-cell-item>
				<u-cell-item title="银行账户" :value="data.yhzh" :arrow="false"></u-cell-item>
				<u-cell-item title="备注" :value="data.remark" :arrow="false"></u-cell-item>
			</u-cell-group>
			<view style="position: fixed;bottom: 0;width: 750rpx;padding: 20rpx 30rpx;z-index: 999;">
				<u-button type="primary" @click="toLijiKaiPiao">立即开票</u-button>
			</view>
		</view>
		<u-toast ref="uToast"></u-toast>
		<myModal ref="myModal"></myModal>
	</view>
</template>
<script>
	import dateUtils from '../../utils/dateUtils.js'
	export default {
		data() {
			return {
				data: null,
				kpsq_id: '',
				host: 'https://cos2.ksmeilv.com',
				form:{}
			}
		},
		onLoad(option) {
			if (option.kpsq_id) {
				this.kpsq_id = option.kpsq_id;
			}
		},
		mounted() {
			this.getOrderInfo();
		},
		methods: {
			myTimeFormat(strDate) {
				return dateUtils.myTimeFormat(strDate);
			},
			toLijiKaiPiao(){
				uni.navigateTo({
					url:'/pages/lijikaipiao/lijikaipiao?kpsq_id='+this.kpsq_id
				})
			},
			getOrderInfo() {
				var that = this;
				that.$http.get('/kpsq/queryById?kpsq_id=' + this.kpsq_id, {}, (res) => {
					if (res.data.success) {
						that.data = res.data.result;
					} else {
						that.$refs.myModal.show('请求失败', res.data.result.message);
					}
				});
			},
		}
	}
</script>

<style>

</style>